//
//  UserTripsTableViewCell.m
//  littleLight's Project-A
//
//  Created by dllo on 16/5/24.
//  Copyright © 2016年 light. All rights reserved.
//

#import "UserTripsTableViewCell.h"
#import <UIImageView+WebCache.h>
@implementation UserTripsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}


- (void)createView
{
    self.imageV = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageV];
    
    self.backView = [[UIView alloc] init];
    self.backView.backgroundColor = [UIColor blackColor];
    self.backView.alpha = 0.2;
    [self.contentView addSubview:self.backView];
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.font = [UIFont systemFontOfSize:20];
    [self.contentView addSubview:self.titleLabel];
    
    self.smallImage = [[UIImageView alloc] init];
    self.smallImage.image = [UIImage imageNamed:@"OriginalCellPic1"];
    [self.contentView addSubview:self.smallImage];
    
    self.countLabel = [[UILabel alloc] init];
    self.countLabel.textColor = [UIColor whiteColor];
    self.countLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.countLabel];
    
    self.detailLabel = [[UILabel alloc] init];
    self.detailLabel.textColor = [UIColor whiteColor];
    self.detailLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.detailLabel];
    
    
    
    
    
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
 
    self.imageV.frame = CGRectMake(5, 5, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 10);
    
    self.backView.frame = CGRectMake(5, 5, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 10);
    
    self.titleLabel.frame = CGRectMake(10, 5, self.contentView.frame.size.width - 20, 50);
    
    self.smallImage.frame = CGRectMake(10, 60, 3, 15);
    
    self.countLabel.frame = CGRectMake(15, 55, 100, 20);
    
    self.detailLabel.frame = CGRectMake(10, self.contentView.frame.size.height - 50, self.contentView.frame.size.width - 10, 40);
    
    
    
    
    
}


- (void)setModel:(Use_tripsModel *)model
{
    _model = model;
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.cover_image_1600]];
    
    self.titleLabel.text = _model.name;
    self.countLabel.text = [NSString stringWithFormat:@"%@地点故事",_model.spot_count];
    
    NSString *str1 = [NSString stringWithFormat:@"%@人浏览 /",_model.view_count];
    NSString *str2 = [NSString stringWithFormat:@" %@人喜欢 /",_model.liked_count];
    NSString *str3 = [NSString stringWithFormat:@" %@评论",_model.total_comments_count];
    
    self.detailLabel.text = [NSString stringWithFormat:@"%@%@%@",str1,str2,str3];
    
    
}





@end
